#include <iostream>
#include <memory>

using namespace std;

int main()
{
	int* a = new int(1);
	int* b = new int(2);

	shared_ptr<int*> pA1 = make_shared<int*>(a);
	shared_ptr<int*> pB1 = make_shared<int*>(b);
	shared_ptr<int*> pA2 = pA1;
	shared_ptr<int*> pB2 = pB1;

	cout << "pA1:" << pA1 << "," << *pA1 << "," << **pA1 << endl;
	cout << "pA2:" << pA2 << "," << *pA2 << "," << **pA2 << endl;
	cout << "pB1:" << pB1 << "," << *pB1 << "," << **pB1 << endl;
	cout << "pB2:" << pB2 << "," << *pB2 << "," << **pB2 << endl;

	cout << "swap(pA1, pB1);" << endl;
	swap(pA1, pB1);

	cout << "pA1:" << pA1 << "," << *pA1 << "," << **pA1 << endl;
	cout << "pA2:" << pA2 << "," << *pA2 << "," << **pA2 << endl;
	cout << "pB1:" << pB1 << "," << *pB1 << "," << **pB1 << endl;
	cout << "pB2:" << pB2 << "," << *pB2 << "," << **pB2 << endl;

	cout << "swap(*pA1, *pA2);" << endl;
	swap(*pA1, *pA2);

	cout << "pA1:" << pA1 << "," << *pA1 << "," << **pA1 << endl;
	cout << "pA2:" << pA2 << "," << *pA2 << "," << **pA2 << endl;
	cout << "pB1:" << pB1 << "," << *pB1 << "," << **pB1 << endl;
	cout << "pB2:" << pB2 << "," << *pB2 << "," << **pB2 << endl;

	cout << "swap(**pA1, **pA2);" << endl;
	swap(**pA1, **pA2);

	cout << "pA1:" << pA1 << "," << *pA1 << "," << **pA1 << endl;
	cout << "pA2:" << pA2 << "," << *pA2 << "," << **pA2 << endl;
	cout << "pB1:" << pB1 << "," << *pB1 << "," << **pB1 << endl;
	cout << "pB2:" << pB2 << "," << *pB2 << "," << **pB2 << endl;

	shared_ptr<int*> pA3 = move(pA1);
	cout << "pA3 = move(pA1);" << endl;
	cout << "pA3:" << pA3 << "," << *pA3 << "," << **pA3 << endl;
	cout << "pA1:" << pA1 << endl;
	cout << "pA2:" << pA2 << "," << *pA2 << "," << **pA2 << endl;
	cout << "pB1:" << pB1 << "," << *pB1 << "," << **pB1 << endl;
	cout << "pB2:" << pB2 << "," << *pB2 << "," << **pB2 << endl;

	pair<int, int> pr1 = { 1, 2 };
	cout << "pr1:" << pr1.first << "," << pr1.second << endl;
	pair<int, int> pr2 = move(pr1);
	cout << "pr2 = move(pr1);" << endl;
	cout << "pr1:" << pr1.first << "," << pr1.second << endl;
	cout << "pr2:" << pr2.first << "," << pr2.second << endl;
	return 0;
}